<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="description" content="慧报考高考志愿测评系统是由长期从事高考志愿指导、教育统计与测量工作的资深专家和教育行业资深软件工程师共同研发，同时提供电脑版、手机版和微信版，主要功能有计划查询、院校查询、专业查询、位次查询、专业测评、智能选校、志愿测评等，系统以大数据为基础为考生提供必要的指导和参考，极大方便考生志愿填报"/>
    <meta name="keywords" content="慧报考,志愿填报,高考志愿测评系统,湖北高考,高考分数,计划查询,院校查询,专业查询,位次查询,专业测评,智能选校,志愿测评,录取查询"/>
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>慧报考</title>
    <link rel="stylesheet" href="/css/moblie.css">
    <link rel="stylesheet" href="/css/md.css">
</head>
<script src="./js/jquery.js"></script>
<body>
    <#include "header.ftl"/>
<div class="bkd-menu flex">
    <a onclick="switchTab('tab1Con',this, 1)" class="f1 active">高招资讯</a>
    <a onclick="switchTab('tab2Con',this, 2)" class="f1">报考资讯</a>
</div>
<div class="bkd-container no-padding">
    <div class="base-news">
    <div class="tabCon tab1Con">
        <div class="rt-list-gz-1">

         </div>
    </div>
    <div class="tabCon tab2Con" style="display: none">
     <div class="rt-list-gz-2">

     </div>
    </div>
    </div>
    <div class="detail-news" style="display: none;">
        <iframe src="" id="ifrNews" frameborder="0" width="100%" height="100%"></iframe>
    </div>
</div>
    <a class="a-top" href="#" style="display: none"> <span>顶部</span></a>
<#--    <#include "footer.ftl"/>-->
</body>
</html>
<#--<script src="/js/viewer.js"></script>-->
<script>
    var typeObj = {
        page1:1,
        page2:1,
        infoType:1
    }
    function switchTab(tabPage,el,type) {
        $('.base-news').show()
        $('.tabCon').hide()
        $('.detail-news').hide()
        $('#ifrNews').removeAttr('src')
        $('.'+ tabPage).show()
        $(el).addClass('active').siblings().removeClass('active')
        typeObj.infoType = type
        $('.rt-list-gz-'+type).children().remove()
        typeObj['page'+type] = 1
        addtempdata()
    }
    var ifrtop = $('.base-news').offset().top
    function toDetail(el) {
        $('.tabCon').hide()
        $('.detail-news').show()
        $('.detail-news').css({
            height : 'calc(100vh - '+ifrtop+'px)'
        })
        $('.base-news').hide()
        ///news/'+item.newsId
        var id = $(el).data('id')
        console.log(id)
        $('#ifrNews').attr('src','/news_content/'+id)
        setTimeout(function () {
          $(window).scrollTop(0)
        },0)
    }
    //获取页面顶部被卷起来的高度
    function scrollTop(){
        return Math.max(
            //chrome
            document.body.scrollTop,
            //firefox/IE
            document.documentElement.scrollTop);
    }
    //获取页面文档的总高度
    function documentHeight(){
//现代浏览器（IE9+和其他浏览器）和IE8的document.body.scrollHeight和document.documentElement.scrollHeight都可以
        return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
    }
    function throttle(fn,time){
        let canUse = true ; // 设置一个开关
        return function(){
            if(!canUse ){ return false } // 如果开关已经关掉了就不用往下了
            // if(canUse) fn.apply(this,arguments)//fn放这里是立即执行
            canUse = false  // 利用闭包刚进来的时候关闭开关
            fn()
            setTimeout(function() {
                canUse = true // 执行完才打开开关
            },time)
        }
    }
    function windowHeight(){
        return (document.compatMode == "CSS1Compat")?
            document.documentElement.clientHeight:
            document.body.clientHeight;
    }
    function addtempdata() {
        $.ajax('api/news/webList?type='+typeObj.infoType+'&page='+typeObj['page'+typeObj.infoType]+'&num=10',{
            success:function (res) {
                var data = res.data.rows
                data.forEach(function (item) {
                    $('.rt-list-gz-'+typeObj.infoType).append('<a data-id="'+item.newsId+'" onclick="toDetail(this)">\n' +
                   // $('.rt-list-gz-'+typeObj.infoType).append('<a href="/news/'+item.newsId+'">\n' +
                        '<div class="gz-item ">\n' +
                        ' <div class="gz-text m-ellipsis">'+item.title+'</div>\n' +
                        ' <div class="gz-date">'+item.time+'</div>\n' +
                        ' </div>\n' +
                        ' </a>')
                })
                typeObj['page'+typeObj.infoType]++
                if(res.data.rows.length == 0) {
                    typeObj['page'+typeObj.infoType]--
                }
            }
        })
    }
    $(function () {

        var thfn = throttle(addtempdata,500)
        $(window).on('scroll',function() {
            if(scrollTop()  > 400) {
                $('.a-top').show()
            }else {
                $('.a-top').hide()
            }
            if(scrollTop() + windowHeight() > (documentHeight() / 2 + 400) ){
                thfn()
            }
        });
        addtempdata()
    })
</script>

<script>
    $('.nav-c-2').trigger('click')
</script>